#include "NormalizedCoordinate.h"
#include "DIVA_Application.h"

//////////////////////////////////////////////////////////////////////////
// This data structure is designed to convert a QPointF, which is used by
// Qt coordinate, to a normalized 2D screen coordinate (Ogre::Real x, Ogre::Real y).
// 
// For more information on normalized screen coordinates, please visit
// http://theoneswiththelight.com/2011/normalized-screen-coordinates-are-awesome/
//////////////////////////////////////////////////////////////////////////

NormalizedCoordinate::NormalizedCoordinate( const QPointF &originalCoordinate ){
	qreal normalizedX = originalCoordinate.x() / DIVA_Application::getInstance()->width();
	qreal normalizedY = originalCoordinate.y() / DIVA_Application::getInstance()->height();
	this->_x = static_cast<Ogre::Real>(normalizedX);
	this->_y = static_cast<Ogre::Real>(normalizedY);
}

NormalizedCoordinate::~NormalizedCoordinate(void)
{
}

Ogre::Real NormalizedCoordinate::x() const{
	return _x;
}

Ogre::Real NormalizedCoordinate::y() const{
	return _y;
}
